<?xml version="1.0" encoding="UTF-8"?>
<!--
To change this template, choose Tools | Templates
and open the template in the editor.
-->
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:p="http://primefaces.prime.com.tr/ui">

    <body>
        <div class="post">

            <h2 class="title">Meus Dados</h2>

            <h:panelGroup id="painelMensagens" layout="block">
                <h:messages errorStyle="color: red" infoStyle="color: green" layout="table"/>
            </h:panelGroup>

            <div id="stylized" class="myform">

                <h:form>

                    <table>

                        <tr>
                            <th><h:outputLabel>Nome: </h:outputLabel></th>
                            <td><h:outputText  value="#{UserController.usuarioLogado.nome}"  /></td>
                        </tr>
                        <tr>
                            <th><h:outputLabel>E-Mail: </h:outputLabel></th>
                            <td><h:outputText  value="#{UserController.usuarioLogado.email}"  /></td>
                        </tr>
                        <tr>
                            <th><h:outputLabel>Login: </h:outputLabel></th>
                            <td><h:outputText value="#{UserController.usuarioLogado.login}" /></td>
                        </tr>
                        <tr>
                            <th><h:outputLabel>Grupo: </h:outputLabel></th>
                            <td><h:outputText  value="#{UserController.usuarioLogado.grupo.nome}" /></td>
                        </tr>
                        <tr>
                            <th><h:outputLabel>Situação: </h:outputLabel></th>
                            <td>
                                <h:outputText value="Ativo" rendered="#{UserController.user.ativo}" />
                                <h:outputText value="Inativo" rendered="#{!UserController.user.ativo}" />
                            </td>
                        </tr>

                    </table>







                </h:form>




                <h3>Mudar Endereço de Email</h3>
                <p>
                    <h:form>
                        <h:panelGrid columns="2" id="painel">
                            
                            <h:outputLabel> Novo Email: <span class="small">Novo E-mail</span></h:outputLabel>
                            <h:inputText  value="#{UserController.newEmail}" required="true" requiredMessage="E-mail requerido." />

                            <h:outputLabel> Repetir Novo Email: <span class="small">Repetir E-mail</span></h:outputLabel>
                            <h:inputText  value="#{UserController.newEmailRepeat}" required="true" requiredMessage="Você deve repetir o novo E-mail." />

                        </h:panelGrid>

                        <h:commandButton styleClass="button" action="#{UserController.changeEmail}" value="Alterar Email" />
                        <h:commandButton styleClass="button" type="reset" value="Limpar" />
                    </h:form>
                </p>
                <br />
                <h3>Mudar Senha</h3>
                <p>
                    <h:form>
                        <h:panelGrid columns="2" id="painel">
                            <h:outputLabel> Senha atual: <span class="small">Senha já cadastrada</span></h:outputLabel>
                            <h:inputSecret  value="#{UserController.senha}" required="true" requiredMessage="Senha Requerida" />

                            <h:outputLabel> Novo Senha: <span class="small">Nova senha desejada</span></h:outputLabel>
                            <h:inputSecret value="#{UserController.novaSenha}" required="true" requiredMessage="Nova Senha Requerida." />

                            <h:outputLabel> Repetir Nova Senha: <span class="small">Repetir a Nova senha</span></h:outputLabel>
                            <h:inputSecret value="#{UserController.repetirNovaSenha}" required="true" requiredMessage="Repetir nova Senha." />

                        </h:panelGrid>

                        <h:commandButton styleClass="button"  action="#{UserController.changeSenha}" value="Alterar Senha" />
                        <h:commandButton styleClass="button" type="reset" value="Limpar" />

                    </h:form>

                </p>





            </div>
        </div>
    </body>
</html>
